package com.slz3.business.module.memberManagement.memJifen.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.memberManagement.memJifen.domain.MemJifen;
import com.slz3.business.module.memberManagement.memJifen.domain.MemJifenCondition;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

public class MemJifenResController {

    static Mono<ServerResponse> add(ServerRequest req, MemJifen memJifen) {
        if (MemJifenResUnsafeValid.add(req, memJifen)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.add_$MemJifenUpdateLock(req, memJifen);
        }
    }

    static final Mono<ServerResponse> delete(ServerRequest req, MemJifenCondition memJifenCondition) {
        if (MemJifenResUnsafeValid.delete(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.delete_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

    static Mono<ServerResponse> modify(ServerRequest req, MemJifen memJifen) {
        if (MemJifenResUnsafeValid.modify(req, memJifen)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.modify_$MemJifenUpdateLock(req, memJifen);
        }
    }

    /**
     *  获取用户积分记录
     * @param req
     * @return
     */
    static Mono<ServerResponse> list(ServerRequest req) {
        if (MemJifenResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResExecutor.list(req);
        }
    }

    static Mono<ServerResponse> info(ServerRequest req) {
        if (MemJifenResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.info_$MemJifenUpdateLock(req);
        }
    }

    static Mono<ServerResponse> choice(ServerRequest req) {
        if (MemJifenResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResExecutor.choice(req);
        }
    }

    static final Mono<ServerResponse> auditSubmit(ServerRequest req, MemJifenCondition memJifenCondition) {
        //
        if (MemJifenResUnsafeValid.auditSubmit(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.auditSubmit_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

    static final Mono<ServerResponse> audit(ServerRequest req, MemJifenCondition memJifenCondition) {
        if (MemJifenResUnsafeValid.audit(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.audit_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

    static final Mono<ServerResponse> auditReject(ServerRequest req, MemJifenCondition memJifenCondition) {
        if (MemJifenResUnsafeValid.auditReject(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.auditReject_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

    static final Mono<ServerResponse> usingEnable(ServerRequest req, MemJifenCondition memJifenCondition) {
        if (MemJifenResUnsafeValid.usingEnable(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.usingEnable_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

    static final Mono<ServerResponse> usingDisable(ServerRequest req, MemJifenCondition memJifenCondition) {
        if (MemJifenResUnsafeValid.usingDisable(req, memJifenCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return MemJifenResAtomic.usingDisable_$MemJifenUpdateLock(req, memJifenCondition);
        }
    }

}
